package com.mysiteforme.dubboprovider.user.bs.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSONObject;
import com.mysiteforme.admin.dao.MenuDao;
import com.mysiteforme.admin.entity.Menu;
import com.mysiteforme.bean.ResponseBean;
import com.mysiteforme.user.bs.UserBS;
import com.mysiteforme.user.dto.UserDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UserBSImpl implements UserBS{

    private static final Logger LOGGER = LoggerFactory.getLogger(UserBSImpl.class);


    @Autowired
    private MenuDao menuDao;

    @Override
    public UserDTO get() {
        return new UserDTO("1","zhangsan",20);
    }

    @Override
    public ResponseBean getBean() {
        List<Menu> list = menuDao.getMenus(null);
        LOGGER.info(JSONObject.toJSONString(list));
        Map data = new HashMap();
        data.put("list",list);
        return   new ResponseBean(200, "成功",null, data);

    }
}
